{layout name="pub/pub_css_js" /}
<script type="text/javascript" src="/static/js/vue2.5.1.js"></script>
<script src="/static/js/axios.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin_page/lib/jquery/1.9.1/jquery.min.js"></script>
<script src="/static/js/jquery.base64.js"></script>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 服务商<span
        class="c-gray en">&gt;</span> 服务商类型列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
                                               href="/admin/Servicetypes/Typelist" title="刷新"><i
        class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container" id="app">
    <a href="javascript:;" @click="Type_add" class="btn btn-primary radius"> 增加类型</a>
    <div class="mt-20">
        <table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
            <thead>
            <tr class="text-c">
                <th width=160">类型id</th>
                <th>类型名称</th>
                <th>类型名称(英)</th>
                <th width="200">操作</th>
            </tr>
            </thead>
            <tbody>

            {foreach $data as $vo}
            <tr class="text-c">
                <td>{$vo['service_type_id']}</td>
                <td>{$vo['service_type_name']}</td>
                <td>{$vo['service_type_name_en']}</td>
                <td class="f-14 td-manage">
                    <a @click="Type_Edit('{$vo[\'service_type_id\']}')" class="btn btn-success">编辑</a>
                    <a @click="Type_del('{$vo[\'service_type_id\']}')" class="btn btn-danger">删除</a>
                </td>
            </tr>
            {/foreach}
            </tbody>

        </table>
        <div class="mt-20">
            {$data->render()}
        </div>
    </div>
</div>
<style>
    .custom-layer {
        margin: 0 auto;
        background: #5eb5e0;
        width: 80%;
        padding: 10px;
        -webkit-border-radius: 10px;
        -moz-border-radius: 10px;
        border-radius: 10px;
        font: 16px "Microsoft YaHei UI";
    }
</style>
<script>
    new Vue({
        el: '#app',
        data: {
            audit_msg: '',
            refuse: false,
            newAddText: '',
            service_id: '',
            status: "",
            keyword: "",
            user_mobile: "",
            user_email: "",
            lists: [
                {value: ''},
            ],
            options: [
                {
                    value: '2',
                    label: '步骤二(基本信息)'
                }, {
                    value: '3',
                    label: '步骤三(证明信息)'
                }],
            refuse_step: 4
        },
        created() {
            this.refuse_step = this.options[0].value;
        },
        methods: {
            Type_Edit: function (service_type_id) {
                layer.open({
                    type: 2,
                    title: '编辑服务商类型',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['800px', '70%'],
                    content: '/admin/Servicetypes/add?service_type_id='+service_type_id,
                    end: function(index, layero){
                        console.log('99999999999');
                        window.location.reload();
                    }
                });
            },
            Type_add: function (service_type_id) {
                layer.open({
                    type: 2,
                    title: '编辑服务商类型',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['800px', '70%'],
                    content: '/admin/Servicetypes/add?service_type_id='+service_type_id,
                    end: function(index, layero){
                        console.log('99999999999');
                        window.location.reload();
                    }
                });
            },
            Type_del: function (service_type_id) {
                layer.confirm('确定要删除吗？', {
                    btn: ['确定', '取消'] //按钮
                }, function () {
                    axios.post('/admin/Servicetypes/del',
                        {
                            service_type_id: service_type_id
                        }
                    ).then(response => {
                        layer.alert(response.data.msg)
                        window.location.reload();
                    })
                })
            }
        }
    });
</script>